package com.ymatou.app.home.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.app.home.parameter.GetProductListBean;
import com.ymatou.app.home.service.GetProductListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
/**
*获取首页最新好货商品列表接口
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetProductList{
	private static GetProductListBean getproductlistBean;
	private static GetProductListCall getproductlistCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取首页最新好货商品列表接口");
	}

	@Before
	public void caseUp() {
		getproductlistBean=new GetProductListBean();
		getproductlistCall=new GetProductListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getproductlistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductList_001() {
		Logger.start(true,"获取首页最新好货商品列表成功");
		try {
			getproductlistBean.setPageIndex(0);
			getproductlistBean.setUserId(1113);
			getproductlistBean.setCookieId("autotest");
			getproductlistBean.setIDFA("autotest");
			getproductlistBean.setIMEI("autotest");
			getproductlistCall.setData(getproductlistBean);
			getproductlistCall.callService();			
			Logger.comment("getproductlistCall send:" + getproductlistCall.getEntityString());
			Logger.comment("getproductlistCall response:" + getproductlistCall.getReturnData());
			Logger.verifyNotNull(getproductlistCall.getProduct(), "验证接口返回数据不为空");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}